package com.zx.druid.controller;

import com.zx.druid.domain.UserInfo;
import com.zx.druid.mapper.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    UserInfoMapper userInfoMapper;

    @RequestMapping("/user")
    public String findUser(){
        return userInfoMapper.selectByPrimaryKey(1).toString();
    }
    @RequestMapping("/user/{name}")
    public List<UserInfo> findUser(@PathVariable String name){
        return userInfoMapper.selectByName(name);
    }
}
